<?php

use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\Breadcrumbs;

/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '就诊记录';
$this->params['breadcrumbs'][] = ['label' => '临床信息', 'url' => ['/clinical/patient']];
$this->params['breadcrumbs'][] = $this->title;
?>

<?= Breadcrumbs::widget([
    'homeLink' => ['label' => '医疗管理系统', 'url' => '#'],
    'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
]) ?>

<div class="visit-medicine-index">

    <p>
        <?= Html::a('创建就诊记录', ['create'], ['class' => 'btn btn-success']) ?>
    </p>

    <table class="table table-bordered">
        <tr>
            <th width="150px">现病史</th>
            <td><?= $info->pt_history ?></td>
        </tr>
        <tr>
            <th>体格检查</th>
            <td><?= $info->pt_body ?></td>
        </tr>
        <tr>
            <th>处理</th>
            <td><?= $info->pt_solution ?></td>
        </tr>
        <tr>
            <th>注意事项</th>
            <td><?= $info->visit_memo ?></td>
        </tr>
    </table>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            'ft_md_time',
            'md_name',
            'md_amount',
            'md_times',
            'md_usage',
            // 'md_side_effect',
            'crt_name',
            'crt_time',

            [
                'class' => 'yii\grid\ActionColumn',
                'buttons' =>[
                    'view' => function($url, $model, $key) {
                        return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', '/clinical/visit/view?id='.$key);
                    },
                    'update' => function($url, $model, $key) {
                        return Html::a('<span class="glyphicon glyphicon-pencil"></span>', '/clinical/visit/update?id='.$key);
                    },
                ],
                'template' => '{view} {update}',
            ],
        ],
    ]); ?>

</div>
